<?php
class ez_Router
{
	protected $controller;
	protected $action;
	protected $_parameters;
	protected $defaultController = 'Home';
	protected $defaultAction = 'Index';
	public function setUrlSuffix($urlsuffix)
	{
		if ($urlsuffix) {
			$suffixArray = explode('/',$urlsuffix);
			$this->controller = strtolower($suffixArray[0]);
			$this->action = strtolower($suffixArray[1]);
			$this->parameters = array();
			for ($i=2;$i<count($suffixArray);$i+=2) {
				$this->_parameters[$suffixArray[$i]] = $suffixArray[$i+1];
			}
		}
	}
	
	public function getController()
	{
		if ($this->controller) {
			return $this->controller;
		} else {
			return $this->defaultController;
		}
	}
	
	public function getAction()
	{
		if ($this->action) {
			return $this->action;
		} else {
			return $this->defaultAction;
		}
	}
	
	public function getParameters()
	{
		if ($this->_parameters) {
			return $this->_parameters;
		} else {
			return array();
		}
	}
}